package com.study.mybatis.dao.impl;

import com.study.mybatis.dao.UserDao;
import com.study.mybatis.pojo.User;

import com.study.mybatis.util.SqlSessionUtil;
import org.apache.ibatis.session.SqlSession;

public class UserDaoImpl implements UserDao {
    @Override
    public User getUserById(int id) {
        SqlSession session = SqlSessionUtil.getSession();

        User user = session.selectOne("test1.getUserById", id);

        return user;
    }

    @Override
    public void insertUser(User user) {
        SqlSession session = SqlSessionUtil.getSession();

        session.insert("test1.insertUser", user);
    }
}
